package tech.dongliang.system.model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import tech.dongliang.common.model.CommonModel;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;

/**
 * <p>
 *
 * </p>
 *
 * @author xdzhang
 * @since 2019-01-18
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
public class SysMenu extends CommonModel {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /**
     * 父菜单ID，一级菜单为0
     */
    @NotNull(message = "上级菜单不能为空")
    private Integer pid;

    /**
     * 菜单名称
     */
    @NotNull(message = "名称不能为空")
    private String name;

    /**
     * 菜单URL
     */
    private String url;
    /**
     * 菜单URL
     */
    private String showUrl;

    /**
     * 授权(多个用逗号分隔，如：user:list,user:create)
     */
    @NotNull(message = "权限不能为空")
    private String perms;

    /**
     * 类型   0：目录   1：菜单   2：按钮
     */
    @Min(value = 0,message = "类型不合格")
    @Max(value = 2,message = "类型不合格")
    @NotNull(message = "类型不能为空")
    private Integer type;

    /**
     * 菜单图标
     */
    private String icon;

    /**
     * 排序
     */
    @NotNull(message = "排序不能为空")
    @TableField("orderNum")
    private Integer orderNum;

    /**
     * 创建时间
     */
    @TableField("createTime")
    private Long createTime;

    /**
     * 修改时间
     */
    @TableField("updateTime")
    private Long updateTime;

}
